import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import federation from "@originjs/vite-plugin-federation";


// https://vite.dev/config/
export default defineConfig({
  server: {
    port: 5176,
    host: '0.0.0.0',
    open: true,
    cors: true, 
    fs: {
    strict: true
    },
    headers: {
      'Access-Control-Allow-Origin': '*',
			'Access-Control-Allow-Headers': '*',
			'Access-Control-Allow-Methods': '*'
    }
 },
  plugins: [
    vue(),
    federation({
      name: "vue-app",  
      filename: "remoteEntry.js", // 添加输出文件名
      remotes: {
         "base": "http://localhost:3000/dist/assets/remoteEntry.js", 
      },
      shared: {
          vue: {
            singleton: true,
            eager: true,
            requiredVersion: "^3.2.45"
          },
          pinia: {
            singleton: true,
            requiredVersion: "^2.2.6"
        }
      }
    }),
  ],
  build: {
    target: 'esnext',
  }
})
